package kr.co.doriclassic.powerjava.chapter12;

public class Rectangle extends Shape{
	private int width;
	private int height;
	
	@Override
	public void draw() {
		System.out.println("사각형을 그렸다.");
	}
	
	public static void main(String[] args) {
		Shape[] arrShape = new Shape[2];
		arrShape[0] = new Rectangle();
		arrShape[1] = new Triangle();
		
		for (Shape sh : arrShape) {
			sh.draw();//오버라이딩 된 자식의 메소드 호출
		}
		
	}
}
class Triangle extends Shape{
	@Override
	public void draw() {
		System.out.println("삼각형을 그렸다.");
	}
	
	
}